<template>
	<view>
		<!-- <uni-nav-bar left-icon="back" left-text="" right-text="" title='修改密码'></uni-nav-bar> -->
		<view class="title">
			若你忘记了密码,可在此重置新密码
		</view>
		<form @submit="formSubmit" @reset="formReset">
			<input name='tel' class="uni-input" focus placeholder="请输入手机号" />
			<view class="password">
				<input name='old' class="uni-input" :password="showPassword" type="text" placeholder="请输入旧密码" />
				<uni-icons @click='isshow' v-if="eyeshow" class='icon' color="#777" type="eye" size="20">
				</uni-icons>
				<uni-icons @click='isshow' v-else class='icon' color="#777" type="email" size="20"></uni-icons>
			</view>
			<view class="password">
				<input name='new' class="uni-input" :password="showPassword" type="text" placeholder="请输入新密码" />
				<uni-icons @click='isshow' v-if="eyeshow" class='icon' color="#777" type="eye" size="20">
				</uni-icons>
				<uni-icons @click='isshow' v-else class='icon' color="#777" type="email" size="20"></uni-icons>
			</view>
			<view class="code">
				<input name='code' class="uni-input" placeholder="验证码" />
				<text>获取验证码</text>
			</view>
			<view class="uni-btn-v">
				<button form-type="submit">重置密码</button>
			</view>
		</form>
	</view>
</template>

<script>
	import {
		register,
		updateMemberInfo,
		updatePassword,
		doLogin,
		uploadAvatar
	} from '../../../../api/my/login/login.js'
	export default {
		data() {
			return {
				showPassword: true,
				eyeshow: true,
				ischeck: 'false',
			};
		},
		methods: {
			// 切换密码看的见不
			isshow() {
				if (this.eyeshow) {
					this.eyeshow = false;
					this.showPassword = false
				} else {
					this.eyeshow = true;
					this.showPassword = true
				}
			},
			// 修改密码
			formSubmit(e) {
				console.log(e.detail.value);
				var value = e.detail.value
				updatePassword({
					"token": uni.getStorageSync('token'),
					"passwordLast": value.old,
					"passwordNew": value.new
				}).then(res => {
					console.log(res);
				})
				// console.log(e.detail.value);
				// var value = e.detail.value
				// uni.request({
				// 	url: 'http://leju.bufan.cloud/lejuClient/login/doLogin',
				// 	method: "POST",
				// 	data: {
				// 		"password": value.password,
				// 		"username": value.name
				// 	},
				// 	success(res) {
				// 		console.log(res);
				// 		if (res.success) {
				// 			uni.showToast({
				// 				title: "登录成功"
				// 			})
				// 			setTimeout(function() {
				// 				uni.navigateTo({
				// 					url: '../my',
				// 				});
				// 			}, 1700)
				// 		}
				// 	}
				// })
				// doLogin({
				// 	'password': value.password,
				// 	'username': value.name
				// }).then(res => {
				// 	console.log(res);
				// })
			}
		}
	}
</script>

<style lang="scss">
	.title {
		width: 590rpx;
		text-align: center;
		margin: 40rpx auto;
		color: #999;
		font-size: 28rpx;
		box-sizing: border-box;
	}

	image {
		width: 160rpx;
		height: 160rpx;
		border-radius: 50%;
		box-sizing: border-box;
		display: block;
		margin: 80rpx auto;
	}

	.password {
		position: relative;
		width: 610rpx;
		box-sizing: border-box;
		margin: 0 auto;

		.icon {
			position: absolute;
			top: 28rpx;
			right: 40rpx;
			z-index: 999;
			width: 32rpx;
			box-sizing: border-box;
			height: 32rpx;
			color: #666;

		}
	}

	input {
		width: 610rpx;
		height: 100rpx;
		padding: 0rpx 40rpx;
		border-radius: 50rpx;
		box-sizing: border-box;
		margin: 0 auto;
		margin-bottom: 40rpx;
		box-shadow: 0 0 60rpx 0 rgba(43, 86, 112, .1);
	}

	.code {
		position: relative;
		width: 610rpx;
		box-sizing: border-box;
		margin: 0 auto;

		text {
			position: absolute;
			font-size: 24rpx;
			top: 34rpx;
			right: 35rpx;
			box-sizing: border-box;
			z-index: 999;
			height: 32rpx;
			color: #666;
		}
	}

	button {
		box-sizing: border-box;
		width: 600rpx;
		height: 100rpx;
		margin: 80rpx auto;
		border-radius: 50rpx;
		color: white;
		line-height: 100rpx;
		background-color: #354E44;
		font-size: 28rpx;
		margin-bottom: 40rpx;
	}

	.radio {
		width: 200rpx;
		margin-left: 275rpx;
		box-sizing: border-box;
		font-size: 28rpx;
	}
</style>
